<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <canvas width="100" height="50" id="codecanvas">
        <script>
        var code=['我','爱','湖','南','网','络','工','程','职','业','学','院'];

   //获取画布对象
   var codecanvas=document.getElementById('codecanvas');
   
        var number=Number.parseFloat(Math.random()*(10+1));
        //获取上下文
         var ctx =codecanvas.msGetRegionContent('2d');
         //书写
         ctx.fillText(code[number],0,10);
        //干扰
        </script>
</body>
</html>